<?php ini_set("precision","2"); ?>
<?php
         $a = Doctrine::getTable('BbSeason')->getStandings($seasonId, $winorlose, $order);
?>
<?php $season = Doctrine::getTable('BbSeason')->findOneBySId($seasonId)?>
<?php $league = Doctrine::getTable('BbLeague')->findOneById($season->getLId())?>
<?php $even=1;?>
<div class="column-left">
<div class="news-title"><?php echo $league." :: ".$season ?></div>	
<div class="mod-container mod-table">
			<div class="mod-header stathead"><h4>Хүснэгт</h4></div>
			<div class="mod-content">
				<table cellspacing="1" cellpadding="3" class="tablehead">
					<tbody>
					<tr align="center" class="colhead">
						  <td>Байр</td>
			              <td align="left">Баг</td>			            
			              <td>
				              <?php 
				              if($order == "desc")
				                echo '&uarr;'.link_to('Хожил', '@standings_index?seasonId='.$seasonId.'&winorlose=win&order=asc');
				              else 
				                echo '&darr;'.link_to('Хожил', '@standings_index?seasonId='.$seasonId.'&winorlose=win&order=desc');
				              ?>	
			              </td> 
			              <td>
				              <?php 
				              if($order == "desc")
				                echo '&uarr;'.link_to('Хожилийн Хувь', '@standings_index?seasonId='.$seasonId.'&winorlose=winperc&order=asc');
				              else 
				                echo '&darr;'.link_to('Хожилийн Хувь', '@standings_index?seasonId='.$seasonId.'&winorlose=winperc&order=desc');
				              ?>
			              </td> 
			              <td>
				              <?php 
				              if($order == "desc")
				                echo '&uarr;'.link_to('Хожигдол', '@stat_index?seasonId='.$seasonId.'&orderByColumn=lose&order=asc');
				              else 
				                echo '&darr;'.link_to('Хожигдол', '@stat_index?seasonId='.$seasonId.'&orderByColumn=lose&order=desc');
				              ?>
			              </td>
			              <td>
				              <?php 
				              if($order == "desc")
				                echo '&uarr;'.link_to('Хожигдолын Хувь', '@stat_index?seasonId='.$seasonId.'&orderByColumn=loseperc&order=asc');
				              else 
				                echo '&darr;'.link_to('Хожигдолын Хувь', '@stat_index?seasonId='.$seasonId.'&orderByColumn=loseperc&order=desc');
				              ?>
			              </td> 
			              <td>
				              <?php 
				              if($order == "desc")
				                echo '&uarr;'.link_to('Оноо', '@stat_index?seasonId='.$seasonId.'&orderByColumn=pts&order=asc');
				              else 
				                echo '&darr;'.link_to('Оноо', '@stat_index?seasonId='.$seasonId.'&orderByColumn=pts&order=desc');
				              ?>
			              </td> 
					</tr>
					
			<?php $i=1; ?><?php $odd=1;?>
              <?php foreach ($a as $key=>$value): ?>
              	<?php $team = Doctrine::getTable('BbTeams')->findOneById($value['teamId']); ?>
               	<tr class="<?php if($odd==1) { echo 'odd'; $odd=0; } else { echo 'even'; $odd=1; }?>" align="center">
              		<td><?php echo $i.'.' ?></td>	
              		<td align="left"><a href="<?php echo url_for('team/show?seasonId='.$seasonId.'&name='.$team)?>"><?php echo $team ?></a></td>
              		<td><?php echo $value['win'] ?></td>
              		<td><?php echo $value['winperc'].'%' ?></td>
              		<td><?php echo $value['lose'] ?></td>          		
              		<td><?php echo $value['loseperc'].'%' ?></td>          		
              		<td><?php echo $value['pts'] ?></td>          		
              	</tr>
            	<?php $i++; endforeach;?>
            </tbody></table>

		</div>
		<div class="foot-footer"></div>
</div>
</div>

<?php include_partial('main/right', array());?>

<br clear="all">
<script type="text/javascript">
 
</script>
